package com.fantasy.map;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Set;

import org.junit.Test;

public class MapTest {

	public static void main(String[] args) {
		HashMap<String ,String> m = new HashMap<>();
		m.put("aa", "bb");
		m.put("aa", "cc");
		m.put("a1", "cc");
		m.put("a2", "cc");
		m.put("a3", "cc");
		System.out.println(m.size());
		System.out.println(m.get("aa"));
		System.out.println("--------------");
		for (String string : m.keySet()) {
			System.out.println(string);
		}
		
		System.out.println("+++++++++++++");
		Set<Entry<String, String>> im = m.entrySet();
		for (Entry<String, String> entry : im) {
			System.out.println(entry.getKey() + "<<<<<<<<<<<<>:>>>>>>>>>>>>>>" + entry.getValue());
		}
	}
	
	@Test
	public void testChange(){
		ArrayList<HashMap<String, String>> aa = new ArrayList<HashMap<String , String>>();
		HashMap<String, String> a1 = new HashMap<>();
		a1.put("1", "55");
		a1.put("2", "55");
		a1.put("3", "55");
		aa.add(a1);
		System.out.println(a1);
		for (int i = 0; i < aa.size(); i++) {
			HashMap<String, String> map = aa.get(i);
			map.put("1", "11");
			map.put("2", "22");
			map.put("3", "33");
		}
		System.out.println(a1);
	}
	
}
